home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / tool_inc.zip / STRIPSPC.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  50 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*------------------------------------------
  14.  *
  15.  * strip_leading_spaces
  16.  *    remove all leading spaces from a string
  17.  *
  18.  *)
  19.  
  20. procedure strip_leading_spaces(var str: anystring);
  21. var                           
  22.    p: integer;
  23.  
  24. begin
  25.    p := 1;
  26.    while (str[p] = ' ') and (p < ord(str[0])) do
  27.       p := succ(p);
  28.  
  29.    if p > 1 then
  30.       delete(str,1,p-1);
  31. end;
  32.  
  33.  
  34. (*------------------------------------------
  35.  *
  36.  * strip_trailing_spaces
  37.  *    remove all text after the first space in a string
  38.  *
  39.  *)
  40.  
  41. procedure strip_trailing_spaces(var str: anystring);
  42. var
  43.    posit:  integer;
  44. begin
  45.    posit := pos(' ',str);
  46.    if posit > 0 then
  47.       str[0] := chr(posit-1);     {remove trailing spaces and comments}
  48. end;
  49.  
  50.